<?php
namespace app\common\behavior;
use think\Exception;
use think\Loader;
use think\Lang;

class Refund 
{
	/**
     * [afterCreateRefund description]
     * @param  [type] &$order_info [description]
     * @return [type]              [description]
     */
    public function afterCreateRefund(&$order_number)
    {
    	try {
            $notice_instance = \services\notices\Notice::instance();
            $order_info      = Loader::model('Orders')->getOrderInfo(['number' => $order_number]);
            $managers        = $order_info->camp->managers;
            foreach ($managers as $manager) {
                $recipients['sign'][] = $manager->sign;
            }
    		//发送通知信息给管理员
            $notice_instance->send($recipients, Lang::get('Refund notice'), Lang::get('A refund application, please timely operation'));
    	} catch (\Exception $e) {
    		
    	}
        
    }

    public function afterCompleteRefund(&$order_number)
    {
        try {
            $notice_instance = \services\notices\Notice::instance();
            $order_info      = Loader::model('Orders')->getOrderInfo(['number' => $order_number]);
            $notice_instance->send(['sign' => Loader::model('common/Users')->getUserInfo($order_info['order_user_id'], 'sign')], Lang::get('Refund completed'), Lang::get('Refund completed'));
            
        } catch (\Exception $e) {
            
        }
    }

    
}